home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2009 March / ME_03_2009.iso / Software / Internet / Firefox 3.0.8.dmg / Firefox.app / Contents / MacOS / firefox < prev    next >
Encoding:
Text File  |  2009-03-26  |  3.9 KB  |  143 lines

  1. #!/bin/sh
  2. #
  3. # ***** BEGIN LICENSE BLOCK *****
  4. # Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. #
  6. # The contents of this file are subject to the Mozilla Public License Version
  7. # 1.1 (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. # http://www.mozilla.org/MPL/
  10. #
  11. # Software distributed under the License is distributed on an "AS IS" basis,
  12. # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. # for the specific language governing rights and limitations under the
  14. # License.
  15. #
  16. # The Original Code is mozilla.org Code.
  17. #
  18. # The Initial Developer of the Original Code is
  19. # Netscape Communications Corporation.
  20. # Portions created by the Initial Developer are Copyright (C) 1998
  21. # the Initial Developer. All Rights Reserved.
  22. #
  23. # Contributor(s):
  24. #
  25. # Alternatively, the contents of this file may be used under the terms of
  26. # either the GNU General Public License Version 2 or later (the "GPL"), or
  27. # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. # in which case the provisions of the GPL or the LGPL are applicable instead
  29. # of those above. If you wish to allow use of your version of this file only
  30. # under the terms of either the GPL or the LGPL, and not to allow others to
  31. # use your version of this file under the terms of the MPL, indicate your
  32. # decision by deleting the provisions above and replace them with the notice
  33. # and other provisions required by the GPL or the LGPL. If you do not delete
  34. # the provisions above, a recipient may use your version of this file under
  35. # the terms of any one of the MPL, the GPL or the LGPL.
  36. #
  37. # ***** END LICENSE BLOCK *****
  38.  
  39. ## $Id: mozilla.in,v 1.16 2007/10/05 07:29:26 reed%reedloden.com Exp $
  40. ## 
  41. ## Usage:
  42. ##
  43. ## $ mozilla [args]
  44. ##
  45. ## This script is meant to run the mozilla-bin binary from either 
  46. ## mozilla/xpfe/bootstrap or mozilla/dist/bin.
  47. ##
  48. ## The script will setup all the environment voodoo needed to make
  49. ## the mozilla-bin binary to work.
  50. ##
  51.  
  52. #uncomment for debugging
  53. #set -x
  54.  
  55. moz_libdir=/usr/local/lib/firefox-3.0.8
  56.  
  57. # Use run-mozilla.sh in the current dir if it exists
  58. # If not, then start resolving symlinks until we find run-mozilla.sh
  59. found=0
  60. progname="$0"
  61. curdir=`dirname "$progname"`
  62. progbase=`basename "$progname"`
  63. run_moz="$curdir/run-mozilla.sh"
  64. if test -x "$run_moz"; then
  65.   dist_bin="$curdir"
  66.   found=1
  67. else
  68.   here=`/bin/pwd`
  69.   while [ -h "$progname" ]; do
  70.     bn=`basename "$progname"`
  71.     cd `dirname "$progname"`
  72.     progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
  73.     progbase=`basename "$progname"`
  74.     if [ ! -x "$progname" ]; then
  75.       break
  76.     fi
  77.     curdir=`dirname "$progname"`
  78.     run_moz="$curdir/run-mozilla.sh"
  79.     if [ -x "$run_moz" ]; then
  80.       cd "$curdir"
  81.       dist_bin=`pwd`
  82.       run_moz="$dist_bin/run-mozilla.sh"
  83.       found=1
  84.       break
  85.     fi
  86.   done
  87.   cd "$here"
  88. fi
  89. if [ $found = 0 ]; then
  90.   # Check default compile-time libdir
  91.   if [ -x "$moz_libdir/run-mozilla.sh" ]; then
  92.     dist_bin="$moz_libdir"
  93.   else 
  94.     echo "Cannot find mozilla runtime directory. Exiting."
  95.     exit 1
  96.   fi
  97. fi
  98.  
  99. script_args=""
  100. debugging=0
  101. MOZILLA_BIN="${progbase}-bin"
  102.  
  103. if [ "$OSTYPE" = "beos" ]; then
  104.   mimeset -F "$MOZILLA_BIN"
  105. fi
  106.  
  107. pass_arg_count=0
  108. while [ $# -gt $pass_arg_count ]
  109. do
  110.   case "$1" in
  111.     -p | --pure | -pure)
  112.       MOZILLA_BIN="${MOZILLA_BIN}.pure"
  113.       shift
  114.       ;;
  115.     -g | --debug)
  116.       script_args="$script_args -g"
  117.       debugging=1
  118.       shift
  119.       ;;
  120.     -d | --debugger)
  121.       script_args="$script_args -d $2"
  122.       shift 2
  123.       ;;
  124.     *)
  125.       # Move the unrecognized argument to the end of the list.
  126.       arg="$1"
  127.       shift
  128.       set -- "$@" "$arg"
  129.       pass_arg_count=`expr $pass_arg_count + 1`
  130.       ;;
  131.   esac
  132. done
  133.  
  134. if [ $debugging = 1 ]
  135. then
  136.   echo $dist_bin/run-mozilla.sh $script_args $dist_bin/$MOZILLA_BIN "$@"
  137. fi
  138. "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"
  139. exitcode=$?
  140.  
  141. exit $exitcode
  142. # EOF.
  143.